package Job

import org.apache.spark.SparkContext
import org.apache.spark.rdd.RDD

object NeedMostTop {def main(args: Array[String]): Unit = {
  val sc: SparkContext = new SparkContext("local[*]", "NeedMostTop")
  val inputPath: String = "file/JobData/input"
  val outputPath: String = "file/JobData/output/NeedMostTop"

  val InfoLine: RDD[String] = sc.textFile(inputPath)
    .repartition(2)

  val res = InfoLine.map(x =>{
    (x.split(",")(2),x.split(",")(1).toInt)
  }).sortBy(_._2,ascending = false)
    .take(5)

  res.foreach(println)
  sc.stop()
}

}
